package com.bestcem.xm.qdes.job;

import com.bestcem.xm.componet.xxljob.annotation.XxlRegister;
import com.bestcem.xm.qdes.service.QdesFinishProjectService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class QdesJobService {

    @Resource
    private QdesFinishProjectService finishProjectService;

    @XxlJob(value = "qdes-finish-project-job")
    //@XxlRegister(cron = "0 */1 * * * ?", triggerStatus = 1, jobDesc = "答卷结束状态更新定时任务")
    @XxlRegister(cron = "${app.qdes.task.finish-project-cron:0 */1 * * * ?}", triggerStatus = 1, jobDesc = "答卷结束状态更新定时任务")
    public void finishProjectStatusJob() {
        log.info("[qdes] 处理问卷状态修改开始");
        finishProjectService.finishProject();
        log.info("[qdes] 处理问卷状态修改结束");
    }
}
